package interview.javabase.reflect;

import java.lang.reflect.Method;

/**
 * @author 大硕
 * 2019-04-02 7:57 AM
 **/
public class ReflectSample {

    public static void main(String[] args) throws Exception {
        Class c = Class.forName("interview.javabase.reflect.Robot");
        Robot r = (Robot) c.newInstance();
        System.out.println(c.getName());
        Method m = c.getDeclaredMethod("sayHello");
        m.setAccessible(true);
        System.out.println(m.invoke(r));
        Thread.sleep(86400L);
    }
}